<title>GtkTreeView as GtkBuildable</title>
<para>
The GtkTreeView implementation of the GtkBuildable interface accepts
-GtkTreeViewColumn objects as <child> elements in UI definitions.
+GtkTreeViewColumn objects as <child> elements and exposes the
+internal GtkTreeSelection in UI definitions.
</para>
<example>
<title>A UI definition fragment with GtkTreeView</title>
</child>
</object>
</child>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="selection">
+ <signal name="changed" handler="on_treeview_selection_changed"/>
+ </object>
+ </child>
</object>
]]></programlisting>
</example>
gint drop_position);
/* GtkBuildable */
-static void gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
- GtkBuilder *builder,
- GObject *child,
- const gchar *type);
-static void gtk_tree_view_buildable_init (GtkBuildableIface *iface);
+static void gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
+ GtkBuilder *builder,
+ GObject *child,
+ const gchar *type);
+static GObject *gtk_tree_view_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname);
+static void gtk_tree_view_buildable_init (GtkBuildableIface *iface);
static gboolean scroll_row_timeout (gpointer data);
g_type_class_add_private (o_class, sizeof (GtkTreeViewPrivate));
}
-static void
-gtk_tree_view_buildable_init (GtkBuildableIface *iface)
-{
- iface->add_child = gtk_tree_view_buildable_add_child;
-}
-
static void
gtk_tree_view_init (GtkTreeView *tree_view)
{
G_OBJECT_CLASS (gtk_tree_view_parent_class)->finalize (object);
}
-\f
+
+static GtkBuildableIface *parent_buildable_iface;
+
+static void
+gtk_tree_view_buildable_init (GtkBuildableIface *iface)
+{
+ parent_buildable_iface = g_type_interface_peek_parent (iface);
+ iface->add_child = gtk_tree_view_buildable_add_child;
+ iface->get_internal_child = gtk_tree_view_buildable_get_internal_child;
+}
static void
gtk_tree_view_buildable_add_child (GtkBuildable *tree_view,
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), GTK_TREE_VIEW_COLUMN (child));
}
+static GObject *
+gtk_tree_view_buildable_get_internal_child (GtkBuildable *buildable,
+ GtkBuilder *builder,
+ const gchar *childname)
+{
+ if (strcmp (childname, "selection") == 0)
+ return G_OBJECT (GTK_TREE_VIEW (buildable)->priv->selection);
+
+ return parent_buildable_iface->get_internal_child (buildable,
+ builder,
+ childname);
+}
+
/* GtkObject Methods
*/